package com.joven.interface2.controller;

import com.joven.core.constant.ResultInfo;
import com.joven.core.constant.Status;
import com.joven.interface2.service.RocketMqService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author joven_wong
 * 2021/6/11 17:20
 * 生产者发送消息
 */
@RestController
@RequestMapping("/demo")
public class RocketMQController {

    @Autowired
    RocketMqService rocketMqService;

    @GetMapping("/send1")
    public ResultInfo send(){
        String i = rocketMqService.testTransaction();
        if(Status.SUCCESS.getCode().equals(i)){
            return ResultInfo.success("send success");
        }
        return ResultInfo.fail("发送失败");
    }


}
